package com.lianziyou.bot.constant;

/**
 * @author Administrator
 */
public interface WeixinPayConst {

    String PAY_HTML = "<html>\n"
        + "    <head>\n"
        + "        <meta charset=\"utf-8\" />\n"
        + "        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>\n"
        + "        <title>支付跳转</title>\n"
        + "        <script type=\"text/javascript\">\n"
        + "        \tconst params = $$params$$\n"
        + "            //调用微信JS controller 支付\n"
        + "\t\t\tfunction handlePay(){\n"
        + "\t\t\t\tif (typeof WeixinJSBridge == \"undefined\") {\n"
        + "\t\t\t\t  if (document.addEventListener) {\n"
        + "\t\t\t\t      document.addEventListener('WeixinJSBridgeReady',onBridgeReady()  , false);\n"
        + "\t\t\t\t      document.addEventListener('onWeixinJSBridgeReady',onBridgeReady()  , false);\n"
        + "\t\t\t\t  } else if (document.attachEvent) {\n"
        + "\t\t\t\t      document.attachEvent('WeixinJSBridgeReady', onBridgeReady());\n"
        + "\t\t\t\t      document.attachEvent('onWeixinJSBridgeReady', onBridgeReady());\n"
        + "\t\t\t\t  }\n"
        + "\t\t\t\t} else {\n"
        + "\t\t\t\t  onBridgeReady();\n"
        + "\t\t\t\t}\t  \n"
        + "\t\t\t}\n"
        + "\n"
        + "\t\t\tfunction onBridgeReady() {\n"
        + "\t\t\t\t  // 调用获取支付签名接口\n"
        + "\t\t\t\tWeixinJSBridge.invoke(\n"
        + "\t\t\t\t    \"getBrandWCPayRequest\",\n"
        + "\t\t\t\t    {\n"
        + "\t\t\t\t      appId: params.jsapiResult.appId, // 微信的appid\n"
        + "\t\t\t\t      timeStamp: params.jsapiResult.timeStamp, //时间戳\n"
        + "\t\t\t\t      nonceStr: params.jsapiResult.nonceStr, //随机串\n"
        + "\t\t\t\t      package: \"prepay_id=\"+params.prepayId,  // 订单号\n"
        + "\t\t\t\t      signType: params.jsapiResult.signType, //微信签名方式：\n"
        + "\t\t\t\t      paySign: params.jsapiResult.paySign //微信签名\n"
        + "\t\t\t\t    },\n"
        + "\t\t\t\t    function(res) {\n"
        + "\t\t\t\t      if (res.err_msg == \"get_brand_wcpay_request:ok\") {\n"
        + "\t\t\t\t        // 使用以上方式判断前端返回,微信团队郑重提示：\n"
        + "\t\t\t\t        //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。\n"
        + "\t\t\t\t        alert(\"支付成功\")\n"
        + "\t\t\t\t        window.history.back();\n"
        + "\t\t\t\t      } else {\n"
        + "\t\t\t\t        alert(\"支付失败，请重新支付\");\n"
        + "\t\t\t\t        window.history.back();\n"
        + "\t\t\t\t      }\n"
        + "\t\t\t\t    }\n"
        + "\t\t\t\t);\n"
        + "\t\t\t}\n"
        + "\n"
        + "\t\t\twindow.onload=function(){\n"
        + "\t\t\t\tdocument.getElementById(\"total\").innerText = params.total\n"
        + "\t\t\t}\n"
        + "\n"
        + "        </script>\n"
        + "    </head>\n"
        + "    <body>\n"
        + "    <br/>\n"
        + "    <font color=\"#9ACD32\"><b>该笔订单支付金额为<span style=\"color:#f00;font-size:50px\"><span id=\"total\"></span>元</span>钱</b></font><br/><br/>\n"
        + "    <div align=\"center\">\n"
        + "        <button style=\"width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer;  color:white;  font-size:16px;\" type=\"button\" onclick=\"handlePay()\" >立即支付</button>\n"
        + "    </div>\n"
        + "    </body>\n"
        + "</html>";

}
